<template>
	<view class="wangji">
		<myNav>
			<view slot="left" @click="back"><uni-icons type="closeempty" color="#fff"></uni-icons></view>
			<view>忘记密码</view>
		</myNav>
		<view class="input-content">
			<view class="input">
				<image src="/static/all/forget/phone.png" mode=""></image>
				<input type="text" v-model="info.phoneNumber" placeholder="请输入大陆手机号11位" placeholder-class="shrumoren1" />
			</view>
			<view class="input">
				<image src="/static/all/forget/code.png" mode=""></image>
				<input type="text" v-model="info.verificationCode" value="" placeholder="请输入密码" placeholder-class="shrumoren" />
				<view class="wnagji back" @click="sendcode">发送验证码</view>
			</view>
		</view>
		<view class="bottom">
			<view class="pointer-left back" @click="back">返回上一页</view>
			<view class="pointer back" @click="verification">下一步</view>
		</view>
	</view>
</template>

<script>
import myNav from '../../components/mynav/mynav.vue';
import { mapMutations } from 'vuex';
import { verification, fogotPass } from '@/api/index.js';
import { MyShow } from '@/util/my.js';
console.log(MyShow);
export default {
	components: {
		myNav
	},
	data() {
		return {
			info: {
				phoneNumber: '',
				verificationCode: ''
			}
		};
	},
	methods: {
		...mapMutations(['back']),
		async sendcode() {
			//发送二维码
			try {
				let reslut = await fogotPass({
					phoneNumber: this.info.phoneNumber
				});
				//成功
				new MyShow('需要渲染的字段').tixing();
			} catch (e) {
				//TODO handle the exception
				new MyShow('需要渲染的字段').tixing();
			}
		},
	 async verification() {//验证二维码
			try {
				let reslut = await verification(this.info);
				//成功
				new MyShow('需要渲染的字段').tixing();
			} catch (e) {
				//TODO handle the exception
				new MyShow('需要渲染的字段').tixing();
			}
			// 成功跳转到p6
			uni.navigateTo({
				url:"p6?phoneNumber="+this.info.phoneNumber
			})
		}
	}
};
</script>

<style lang="scss">
@import './main.scss';
.shrumoren1 {
	color: #000;
}
</style>
